package com.azunitech.guice;

import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;

import com.google.inject.Guice;
import com.google.inject.Injector;

public class InterceptorTester {
	private static Logger logger = Logger.getLogger(InterceptorTester.class);
	private Injector injector;
	private IRepository processor;
	@Before public void before(){
		injector = Guice.createInjector(new GuiceCacheModule());
		processor = injector.getInstance(EmployeeRepository.class);	
		processor.persistEmployee(new Employee(1, "bill", "li"));
		processor.persistEmployee(new Employee(2, "John", "Smith"));
		processor.persistEmployee(new Employee(3, "Gush", "Obama"));
	}
	
	@Test public void test(){
		logger.info("invoke getEmployee with empId " + 3);
		Employee r = processor.getEmployee(3);
		logger.info(r);
		logger.info("invoke getEmployee with empId " + 3);
		r = processor.getEmployee(3);
		logger.info(r);
	}
}
